<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>沂水旅游-创建订单</title>
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css">
    <link rel="stylesheet" href="/static/index/css/base.css">
    <link rel="stylesheet" href="/static/index/css/baseDetail.css">
    <link rel="stylesheet" href="/static/index/css/tourDetail.css">
    <link rel="stylesheet" href="/static/index/css/createOrder.css">
</head>
<body>

{include file="public/header" model='tour' /}

<div class="searchBox layui-hide-xs">
    <div class="layui-container mbx-top-nav">
        <div class="mianbaoxie-nav">
            <span class="layui-breadcrumb">
              <a href="/">首页</a>
              <a><cite>门票预定</cite></a>
            </span>
        </div>

        <div class="weather">
            <iframe name="weather_inc" src="http://i.tianqi.com/index.php?c=code&id=5&py=linyi2" width="200" height="30" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" ></iframe>
        </div>

    </div>
</div>

<div class="main-box">

    <div class="layui-container">
        <div class="buy-step">
            <div class="layui-row layui-col-space15">

                <div class="layui-col-md4">

                    <div class="stepBox">

                        <div class="step-top">
                            <div class="step-line step-line-active">
                                <div class="step-point step-point-active">
                                    <span></span>
                                </div>
                            </div>

                        </div>
                        <div class="step-name step-name-active">
                            提交订单
                        </div>

                    </div>
                </div>

                <div class="layui-col-md4">

                    <div class="stepBox">

                        <div class="step-top">
                            <div class="step-line">
                                <div class="step-point">
                                    <span></span>
                                </div>
                            </div>

                        </div>
                        <div class="step-name">
                            在线支付
                        </div>

                    </div>
                </div>

                <div class="layui-col-md4">

                    <div class="stepBox">

                        <div class="step-top">
                            <div class="step-line">
                                <div class="step-point">
                                    <span></span>
                                </div>
                            </div>
                        </div>
                        <div class="step-name">
                            完成购买
                        </div>

                    </div>
                </div>

            </div>
        </div>

    </div>

    <div class="layui-container">
        <div class="layui-row layui-col-space12">

            <div class="layui-col-md9">
                <div class="order-left">

                    <div class="take-user">
                        <div class="info-title">
                            <i class="layui-icon layui-icon-form" style="font-size: 22px; color:#20E6BA;"></i>
                            <p>取票人信息</p>
                            <span>（用于接收订单反馈）</span>
                        </div>

                        <div class="info-form layui-form">

                            <div class="layui-form-item">
                                <label class="layui-form-label">* 取票人姓名</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="linkman" id="linkman" placeholder="请输入姓名" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">* 手机号码</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="tel" id="tel" placeholder="请输入手机号码" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                        </div>
                    </div>

                    <div class="ticket-price-b">

                        <div class="info-title">
                            <i class="layui-icon layui-icon-form" style="font-size: 22px; color:#20E6BA;"></i>
                            <p>优惠信息</p>
                        </div>

                        <div class="info-discount">

                            <div class="the-ticket-price">

                                <div class="the-label">产品价格：</div>
                                <div class="the-price" id="the-price">
                                    ￥<span>
                                        {$ticket.price*1}
                                    </span>元
                                </div>

                            </div>

                            <div class="the-ticket-discount">

                                <div class="the-label">优惠折扣：</div>
                                <div class="the-discount" id="the-discount">
                                    -￥<span>
                                        
                                        {eq name="ticket.is_discount" value="1"}
                                            {$ticket.price*1 - $ticket.discount_price*1}
                                        {else/}
                                            0
                                        {/eq}

                                    </span>元
                                </div>

                                {eq name="ticket.is_discount" value="1"}
                                    <div class="the-dis-tag">今日特惠</div>
                                {/eq}
                                

                            </div>

                        </div>

                    </div>

                </div>
            </div>

            <div class="layui-col-md3">

                <div class="order-right">

                    <div class="order-right-title">
                        <i class="layui-icon layui-icon-form" style="font-size: 22px; color:#20E6BA;"></i>
                        <p>商品详情</p>
                    </div>
                    <div class="order-right-info">

                        <h1>{$ticket.tour_name}-{$ticket.tname}</h1>
                        <div class="use-time">
                            <span>使用日期</span>
                            <span>{$param.date}</span>
                        </div>
                        <div class="use-price">
                            <span>门票价格</span>
                            <span>{$param.num}*￥{$ticket.price*1}</span>
                        </div>
                        <div class="use-discount">
                            <span>优惠信息</span>
                            <span style="color: #FF4C4C;">
                                -￥
                                {eq name="ticket.is_discount" value="1"}
                                    {php} echo ($ticket['price']*1 - $ticket['discount_price']*1)*$param['num']; {/php}
                                {else/}
                                    0
                                {/eq}
                            </span>
                        </div>

                    </div>


                    <div class="order-money">
                        <p>应付金额</p>
                        <p class="need-money">
                            ￥<span>

                                {eq name="ticket.is_discount" value="1"}
                                    {$ticket.discount_price*1*$param['num']}
                                {else/}
                                    {$ticket.price*1*$param['num']}
                                {/eq}

                            </span>
                        </p>
                    </div>


                </div>

            </div>
        </div>
    </div>
</div>

<div class="to-buy">
    <div class="layui-container">
        <div class="layui-row">
            <div class="layui-col-md6">

                <div class="xieyi">
                    <form class="layui-form" action="">
                        <input type="checkbox" name="is_read" title="已阅读并同意" lay-skin="primary" checked>
                        <a href="javascript:;">沂水旅游网预定协议</a>
                    </form>
                </div>

            </div>
            <div class="layui-col-md6">

                <div class="addButton">
                    <a href="javascript:;" id="createOrderButton">立即付款</a>
                </div>

            </div>
        </div>
    </div>

</div>

{include file="public/footer"  /}

<script>
    var $ = layui.jquery;
    var   layer = layui.layer
        , element = layui.element
        , carousel = layui.carousel
        , flow = layui.flow
        , laypage = layui.laypage
        , form = layui.form;

        form.render();
        element.init();

        $('#createOrderButton').click(function(){

            var linkman = $('#linkman').val();
            var tel = $('#tel').val();

            if (linkman == '') {
                layer.msg('请填写取票人姓名',{time:1500,icon:2});
                return false;
            }

            if (tel == '') {
                layer.msg('请填写取票人电话',{time:1500,icon:2});
                return false;
            }

            var loading = layer.load(1); 

            var uid = "{$Think.session.uid}";
            var ticket_date = "{$param.date}";
            var ticket_count = "{$param.num}";
            var tid = "{$param.ticket_id}";

            $.ajax({
                    type: "post",
                    url: "{:url('Tour/createOrder')}",
                    dataType: 'json',
                    data: {
                        linkman:linkman,
                        tel:tel,
                        uid:uid,
                        ticket_date:ticket_date,
                        ticket_count:ticket_count,
                        tid:tid
                    },

                    success:function(res){

                        layer.close(loading);

                        if (res.code == 200) {
                        
                            layer.msg(res.msg,{time:1000},function(){
                                
                                window.location.href = "{:url('orderPay')}?order_sn=" + res.data.order_sn;

                            });
                           

                        }else{
                            layer.msg(res.msg,{time:1000});
                        }

                    }
                });


        });


</script>

</body>
</html>